﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using QRCodeBluetooth.BUS;
using QRCodeBluetooth.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace QRCodeBluetooth.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class RecordController : ControllerBase
    {
        private JwtSettings _jwtSettings;
        IHttpContextAccessor _access;
        public RecordController(IOptions<JwtSettings> jwtSettingsAccesser, IHttpContextAccessor access
        )
        {
            _jwtSettings = jwtSettingsAccesser.Value;
            _access = access;
        }

        [HttpPost]
        [Route("QueryRecordInfo")]
        public ResponseMessage QueryRecordInfo(RecordInfo recordInfo)
        {
            ResponseMessage message = new ResponseMessage();
            RecordBUS recordBUS = new RecordBUS();
            message = recordBUS.QueryRecord(recordInfo);
            return message;
        }


        [HttpPost]
        [Route("DeleteRecordInfo")]
        public ResponseMessage DeleteRecordInfo(string ids)
        {
            ResponseMessage message = new ResponseMessage();
            RecordBUS recordBUS = new RecordBUS();
            message = recordBUS.DeleteRecord(ids);
            return message;
        }
    }
}
